package psd.scala.rules

import scala.collection.mutable

import psd.model.Bug
import psd.scala.FactDb

class AbstractClassWithoutMethods (description: String) extends AbstractRule(description) {
  
  def execute(db: FactDb): mutable.ArrayBuffer[Bug]= {

   	val classDefTlist = db.classDefTList
   	val result = new mutable.ArrayBuffer[Bug]
   	 
	val noMethods = classDefTlist.filter(_.isAbstract).filter(_.methodCount == 0)
	
	for (nm <- noMethods ) {
			 val bug = new Bug
		     bug.set_lineNumber(nm.line.toInt)
		     bug.set_path(nm.path)
	    	 bug.set_ruleName(this.getClass().toString())
	    	 bug.set_description(this.description)
	    	 result+=bug
	}
   	 return result
  }

}